server.modules = (
  "mod_access",
  "mod_accesslog",
  "mod_alias",
  "mod_cgi",
  "mod_scgi",
  "mod_fastcgi",
  "mod_redirect",
  "mod_rewrite",
  "mod_deflate",
  "mod_simple_vhost",
  "mod_gnutls"
)

server.document-root = "${WWW_DIR}"
server.port = ${HTTP_PORT}
server.use-ipv6 = "disable"
server.bind = "0.0.0.0"
server.tag = "HTTP Server"
server.username = "${USER}"
server.groupname = "${GROUP}"

accesslog.filename = "${META_DIR}/access.log"
server.errorlog  = "${META_DIR}/error.log"
server.pid-file = "${META_DIR}/server.pid"
server.errorfile-prefix = "${CONFIG_DIR}/status/status-"

server.network-backend = "linux-sendfile"
server.follow-symlink = "enable"
server.max-connections = 8000
server.max-fds = 24000
server.max-write-idle = 30
server.max-read-idle = 30
server.max-keep-alive-requests = 30
server.max-keep-alive-idle = 30

server.range-requests = "enable"

dir-listing.activate = "enable"
dir-listing.encoding = "utf-8"
server.upload-dirs = ( "${UPLOAD_DIR}" )

include "mimetype.conf"
include "ssl.conf"
include "rewrite.conf"

deflate.compression-level = 6
deflate.min-compress-size = 200

alias.url = ()

simple-vhost.server-root = "${WWW_DIR}"
simple-vhost.default-host = "default"
simple-vhost.document-root = "public"

cgi.assign = (
  ".cgi" => ""
)
scgi.server = (
  "!" => ((
    "host" => "127.0.0.1",
    "port" => ${SCGI_PORT},
    "fix-root-scriptname" => "enable",
    "check-local" => "disable",
    "allow-x-send-file" => "enable"
  ))
)
fastcgi.server = (
  ".php" => ((
    "socket" => "${PHP_DIR}/php.socket",
    "bin-path" => "${SRC_DIR}/dist/bin/php-cgi",
    "idle-timeout" => 20,
    "max-procs" => 500,
    "bin-environment" => (
      "PHP_FCGI_CHILDREN" => "15",
      "PHP_FCGI_MAX_REQUESTS" => "500",
      "PHPRC" => "${CONFIG_DIR}",
      "REAL_SCRIPT_NAME" => ""
    ),
    "bin-copy-environment" => (
      "PATH", "SHELL", "USER"
    ),
    "broken-scriptfilename" => "enable"
  ))
)

$HTTP["url"] =~ "/uploads/" {
  cgi.assign = ()
  scgi.server = ()
  fastcgi.server = ()
}
